package com.bao.work.generics;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.TreeSet;

/**
 * @author baoye
 * @date 2024-07-30/19:32
 */
public class Main {
    public static void main(String[] args) {
        ArrayList<Student> students=new ArrayList<>();
        students.add(new Student("liusan",20,90.0));
        students.add(new Student("lisi",22,90.0));
        students.add(new Student("wangwu",20,99.0));
        students.add(new Student("sunliu",22,100.0));
        students.add(new Student("caijiu",25,91.0));

        for(int i=0;i< students.size();i++){
            for(int j=1;j<students.size()-i;j++){
                if(students.get(j).compareTo(students.get(j-1))<0){
                    Student temp=students.get(j);
                    students.set(j,students.get(j-1));
                    students.set(j-1,temp);
                }
            }
        }
        students.forEach(s-> System.out.println(s.getName()+":"+s.getAge()+","+s.getScore()));

    }
}
